<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title></title>
</head>
<body>
<strong>rt-scope</strong><br/>
This directive creates a new JavaScript scope by creating a new method and invoking it with its current context.<br/>
The syntax is rt-scope="expr1 as var1; expr2 as var2. This allows for a convenient shorthand to make the code more readable.<br/>
It also helps to execute an expression only once per scope.<br/>

<a href="https://github.com/wix/react-templates/blob/gh-pages/README.md#rt-scope">Online documents</a><br/>

<h2>Sample:</h2>

<pre>
    &lt;div&nbsp;rt-repeat=&quot;rpt&nbsp;in&nbsp;array&quot;&gt;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&lt;div&nbsp;rt-scope=&quot;')'&nbsp;as&nbsp;separator;&nbsp;rpt.val&nbsp;as&nbsp;val&quot;&gt;{rptIndex}{separator}&nbsp;{val}&lt;/div&gt;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&lt;div&gt;'rpt'&nbsp;exists&nbsp;here,&nbsp;but&nbsp;not&nbsp;'separator'&nbsp;and&nbsp;'val'&lt;/div&gt;<br/>&lt;/div&gt;
</pre>

<h2>Compiled:</h2>
<pre>
define([
    'react',
    'lodash'
], function (React, _) {
    'use strict';
    function scopeSeparatorVal1(rpt, rptIndex, separator, val) {
        return React.DOM.div({}, rptIndex + separator + ' ' + val);
    }
    function repeatRpt2(rpt, rptIndex) {
        return React.DOM.div({}, scopeSeparatorVal1.apply(this, [
            rpt,
            rptIndex,
            ')',
            rpt.val
        ]), React.DOM.div({}, '\'rpt\' exists here, but not \'separator\' and \'val\''));
    }
    return function () {
        return _.map(array, repeatRpt2.bind(this));
    };
});
</pre>
</body>
</html>
